﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Jxym.DBUtility;
using Jxym.wlkc2011.Module.CMS.MODEL;

namespace Jxym.wlkc2011.WebSite
{
    public partial class MyContent : System.Web.UI.Page
    {
        private string _siteName;

        public string SiteName
        {
            get { return _siteName; }
            set { _siteName = value; }
        }
        private string _navigationHtml;
        MsSqlDal<Cms_ContentClass> ccc = new MsSqlDal<Cms_ContentClass>();
        private string _menuTitle;
        private string _contentHtml = "没有找到相关信息，已删除或已移动";
        private string _contentTitle = "提示信息";
        private string _contentUser;
        private string _contentDate;
        private string _videoFile;
        private string _bigIm;

        public string BigIm
        {
            get { return _bigIm; }
            set { _bigIm = value; }
        }

        public string VideoFile
        {
            get { return _videoFile; }
            set { _videoFile = value; }
        }
        public string ContentHtml
        {
            get { return _contentHtml; }
            set { _contentHtml = value; }
        }
        public string ContentTitle
        {
            get { return _contentTitle; }
            set { _contentTitle = value; }
        }
        public string ContentUser
        {
            get { return _contentUser; }
            set { _contentUser = value; }
        }
        public string ContentDate
        {
            get { return _contentDate; }
            set { _contentDate = value; }
        }
        public string NavigationHtml
        {
            get { return _navigationHtml; }
            set { _navigationHtml = value; }
        }
        public string MenuTitle
        {
            get { return _menuTitle; }
            set { _menuTitle = value; }
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.Params["siteName"] != null)
            {
                _siteName = Request.Params["siteName"];
            }
            if (Request.Params["menu"] != null)
            {
                string menuStr = Request.Params["menu"];

                string[] menus = menuStr.Split('_');

                foreach (string menu in menus)
                {
                    Cms_ContentClass cccInfo = ccc.GetModel(menu);
                    _navigationHtml += "&nbsp;&gt;&nbsp;" + cccInfo.Title;
                }
            }

            MsSqlDal<Cms_Content> cct = new MsSqlDal<Cms_Content>();

            if (Request.Params["contentclassid"] != null)
            {
                contentclassid = Request.Params["contentclassid"];

                Cms_Content cctInfo = cct.GetModel("ContentClassID=" + contentclassid, null);

                if (cctInfo != null)
                {
                    _menuTitle = "&nbsp;&gt;&nbsp;" + cctInfo.Title;

                    _contentTitle = cctInfo.Title;

                    //Literal1.Text = "<img src=\"" + "UpFiles/" + _siteName + "/" + cctInfo.BigIm + "\" width=434; height=279; style=\" float:none;" + "\"/>";

                    _videoFile = (cctInfo.VideoFileName != "no.flv" && cctInfo.VideoFileName != "") ? "<a class=\"video\" href=\"" + _siteName + "_newVideo_" + cctInfo.ID + ".htm\" target=\"_blank\" title=\"相关视频\">相关视频</a>" : "";

                    _contentUser = cctInfo.AddUser;

                    _contentDate = cctInfo.AddTime.ToString("yyyy年MM月dd日");

                    _contentHtml = Module.CMS.Public.cmsPublic.ViewContent(_siteName, cctInfo, "100%", "580px");
                }
                else
                {
                    _contentHtml = "暂无信息";
                }
            }
        }

        public string contentclassid { get; set; }
    }
}